package AlienArena::Server::CVar::DMFlags::Constants;
use base 'Exporter';
use strict;
use warnings;

our @EXPORT = qw(
DF_NO_HEALTH
DF_NO_ITEMS
DF_WEAPONS_STAY
DF_NO_FALLING
DF_INSTANT_ITEMS
DF_SAME_LEVEL
DF_SKINTEAMS
DF_NO_FRIENDLY_FIRE
DF_SPAWN_FARTHEST
DF_FORCE_RESPAWN
DF_NO_ARMOR
DF_ALLOW_EXIT
DF_INFINITE_AMMO
DF_QUAD_DROP
DF_QUADFIRE_DROP
DF_BOT_AUTOSAVENODES
DF_BOTCHAT
DF_BOT_FUZZYAIM
DF_BOTS
DF_BOT_LEVELAD
%bitnames
);

sub DF_NO_HEALTH { 0x00000001 }
sub DF_NO_ITEMS { 0x00000002 }
sub DF_WEAPONS_STAY { 0x00000004 }
sub DF_NO_FALLING { 0x00000008 }
sub DF_INSTANT_ITEMS { 0x00000010 }
sub DF_SAME_LEVEL { 0x00000020 }
sub DF_SKINTEAMS { 0x00000040 }
sub DF_NO_FRIENDLY_FIRE { 0x00000100 }
sub DF_SPAWN_FARTHEST { 0x00000200 }
sub DF_FORCE_RESPAWN { 0x00000400 }
sub DF_NO_ARMOR { 0x00000800 }
sub DF_ALLOW_EXIT { 0x00001000 }
sub DF_INFINITE_AMMO { 0x00002000 }
sub DF_QUAD_DROP { 0x00004000 }
sub DF_QUADFIRE_DROP { 0x00010000 }
sub DF_BOT_AUTOSAVENODES { 0x00020000 }
sub DF_BOTCHAT { 0x00040000 }
sub DF_BOT_FUZZYAIM { 0x00080000 }
sub DF_BOTS { 0x00100000 }
sub DF_BOT_LEVELAD { 0x00200000 }

our %bitnames;

foreach (@EXPORT) {
    next if /bitnames/;
    my ($bitname) = /DF_(.*)/;
    $bitnames{eval "$_"} = lc $bitname;
}

=head1 NAME

AlienArena::Server::CVar::DMFlags::Constants - DMFlags bit constants

=head1 DESCRIPTION

Bit constants for dmflags cvar, as defined in C<q_shared.h>.

%bitnames maps the constants to the flag name (lower case with 
DF_ stripped.

=cut

1;
